toCondition

Convert this field to a ValidatedCondition. The provided condition (and any others you append) must pass for the stored value to be provided, otherwise the fallback will be supplied.

Return

this condition

Author

fzzyhmstrs

Since

0.5.4

Parameters

condition

Condition a condition to check before passing the stored value

Throws

if the fallback is this


open fun toCondition(condition: Supplier<Boolean>, failMessage: Text, fallback: Supplier<T>): ValidatedCondition<T>

Convert this field to a ValidatedCondition. The provided condition (and any others you append) must pass for the stored value to be provided, otherwise the fallback will be supplied.

Note: a ValidatedField is a supplier. If you want a custom failMessage, this is a valid overload of withCondition(ValidatedField<Boolean>)

Return

this condition

Author

fzzyhmstrs

Since

0.5.4

Parameters

condition

Supplier a supplier of booleans for the condition to check against

failMessage

Text a message to provide to a tooltip if a condition isn't met

Throws

if the fallback is this


open fun toCondition(condition: ValidatedField<Boolean>, fallback: Supplier<T>): ValidatedCondition<T>

Convert this field to a ValidatedCondition using the provided validation as a supplier. The provided condition (and any others you append) must pass for the stored value to be provided, otherwise the fallback will be supplied.

Return

this condition

Author

fzzyhmstrs

Since

0.5.4

Parameters

condition

ValidatedField a condition to check before passing the stored value

Throws

if this field is passed into itself


open fun toCondition(scope: String, failMessage: Text, fallback: Supplier<T>): ValidatedCondition<T>

Convert this field to a ValidatedCondition using the provided scope with a default boolean provider. The provided condition (and any others you append) must pass for the stored value to be provided, otherwise the fallback will be supplied. The provided scope must point to a valid boolean config scope otherwise the initial condition will never pass.

Return

this condition

Author

fzzyhmstrs

Since

0.5.4

Parameters

scope

String - a config scope pointing to a boolean or validated boolean.

failMessage

Text a message to provide to a tooltip if a condition isn't met

Throws

if the fallback is this